<?php
/*
	auth.inc
		会员验证和权限校验文件
	#author: corrie
	#update: corrie
	#latest: 03/02/09
	#version: 1.1
*/

//print_r($_SESSION['login']);
$pageurl = 'http://'.$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"];

if ($_SESSION['login']['t_valid'] && $timestamp>$_SESSION['login']['t_valid']){
	unset($_SESSION['login']);
}

if($_SESSION['login']['flag'] && $_SESSION['login']['flag']!=1){
	jump('warn', '登陆超时，请重新登陆','', NXHOST.'?login&forward='.urlencode($pageurl));
}else{
	//成功登陆，并生成信息
	//1、读取会员信息并保存
	//data::selectfirst('n_person');
	//2、读取权限信息并保存
}

$tpl->assign('login', $_SESSION['login']);

function auth(){
	global $pageurl;
	if(!isset($_SESSION['login'])){
		jump('warn', '没有登陆，请登陆后再访问','', NXHOST.'?login&forward='.urlencode($pageurl));
	}
}
function logout(){
	unset($_SESSION['login']);
	header("Location: ".NXHOST);
	exit;
}
/*header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );*/
?>